/*
    This file is part of Raptor.

    Raptor is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Raptor is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Raptor.  If not, see <http://www.gnu.org/licenses/>.

 */

#ifndef __RSDF_H__
#define __RSDF_H__

#include "polarssl/aes.h"
#include "polarssl/base64.h"

#include <QObject>
#include <QTcpSocket>
#include <QFile>

class container : public QTcpSocket
{
	Q_OBJECT

	public:
		container();
		~container();

		QStringList decryptRSDF(const QString &fileName);
		QStringList decryptRSDF(QFile &file);

		QStringList decryptCCF(const QString &fileName);
		QStringList decryptCCF(QFile &file);

		QStringList decryptDLC(const QString &fileName);
		QStringList decryptDLC(QFile &file);

	public slots:

	signals:

	private:
		void cfb_decrypt(aes_context *ctx, int length, unsigned char *iv, unsigned char *input, unsigned char *output);
		void cfb_encrypt(aes_context *ctx, int length, unsigned char iv[16], unsigned char *input, unsigned char *output);

		void rotateRight(quint32 *magic, unsigned int cnt);
		void rotateLeft(quint32 *magic, unsigned int cnt);

	private slots:

};

#endif
